﻿<UserControl x:Class="QuailDashboard.View.Controls.ConfigureEnvironmentControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:QuailControls="clr-namespace:QuailDashboard.View.Controls" 
    xmlns:c1grid="clr-namespace:C1.Silverlight.DataGrid;assembly=C1.Silverlight.DataGrid" 
    Width="700" Height="500">
    <Grid x:Name="LayoutRoot" Background="White" Loaded="LayoutRoot_Loaded">
        <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="43"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <Border x:Name="borderBorder"
                Grid.Row="0"
                Grid.RowSpan="2"
                CornerRadius="5" 
				Background="White"
                BorderBrush="LightGray"
                BorderThickness="1"
                >
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
        </Border>
        <TextBlock Text="{Binding Caption}" FontSize="18" FontWeight="Bold" Margin="10" Grid.Row="0" />
        <Grid x:Name="ListGrid" Grid.Row="1" Margin="10" >
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="25" />
                <RowDefinition Height="35" x:Name="RowSave" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <!-- <Grid Grid.Row="0" Grid.Column="0">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions> -->
                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Grid.Row="0" Grid.Column="0">
                    <c1grid:C1DataGrid 
                            AlternatingRowBackground="Beige" 
                            AutoGenerateColumns="False" 
                            RowHeight="Auto"
                            
                            x:Name="GridValues">
                        <c1grid:C1DataGrid.Columns>
                            <c1grid:DataGridTemplateColumn
                                                    Header="Name"
                                                    MinWidth="75">
                                <c1grid:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Name, Mode=TwoWay}" />
                                    </DataTemplate>
                                </c1grid:DataGridTemplateColumn.CellTemplate>
                            </c1grid:DataGridTemplateColumn>

                            <c1grid:DataGridTemplateColumn
                                                    Header="Value"
                                                    MinWidth="225">
                                <c1grid:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBox
                                                            TextWrapping="Wrap"
                                                            MaxWidth="750"
                                                            Text="{Binding Value, Mode=TwoWay}"
                                                            HorizontalScrollBarVisibility="Auto"
                                                            VerticalScrollBarVisibility="Auto"
                                                            MaxHeight="120"/>
                                    </DataTemplate>

                                </c1grid:DataGridTemplateColumn.CellTemplate>
                            </c1grid:DataGridTemplateColumn>
                        </c1grid:C1DataGrid.Columns>


                    </c1grid:C1DataGrid>
                </ScrollViewer>
           <!-- </Grid> -->
            <!--            <TextBlock Grid.Row="0" Grid.Column="0" Text="Name:" FontWeight="Bold" />
            <TextBox x:Name="Name" Grid.Row="0" Grid.Column="1" Margin="0,1,10,1" VerticalAlignment="Center" 
                     Text="{Binding EnvironmentName, Mode=TwoWay}"/>

            <TextBlock Grid.Row="1" Grid.Column="0" Text="Description:" FontWeight="Bold" />
            <TextBox x:Name="Description" Grid.Row="1" Grid.Column="1" Margin="0,1,10,1" VerticalAlignment="Center" 
                     Text="{Binding EnvironmentDescription, Mode=TwoWay}"/>
            -->

            <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Margin="5,5,0,5" Click="ButtonSave_Click">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text=" Save " />
                        <Image
                                Stretch="None"
                                Source="{StaticResource IconAccept}"
                                Margin="0,0,5,0"
                                 />
                    </StackPanel>
                </Button>

                <Button Margin="5,5,0,5" Click="ButtonCancel_Click">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text=" Cancel " />
                        <Image
                                Stretch="None"
                                Source="{StaticResource IconCancel}"
                                Margin="0,0,5,0"
                                 />
                    </StackPanel>
                </Button>
            </StackPanel>
        </Grid>
        </Grid>
        <QuailControls:ProcessingModalControl Text="{Binding ProcessingText}"
                    ModalVisibility="{Binding IsProcessing, Converter={StaticResource VisibilityConverter}}" />
    </Grid>
</UserControl>
